package com.hubu.utils;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.hubu.domain.User;


/**
 * @Author xiedi
 * @Date: 2022/10/19
 */
public class TokenUtil {

    /**
     * 生成token 的方法
     * @param user
     * @return
     */
    public static String  getToken(User user){
        String token = "";
        token = JWT.create().withAudience(String.valueOf(user.getId()))
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }

}
